#include "mainwindow.h"

int main( int argc, char* argv[] )
{
    QApplication app( argc, argv );

    QFile file( ":/style.qss" );
    if( file.open( QIODevice::ReadOnly | QIODevice::Text ) )
    {
        app.setStyleSheet( file.readAll() );
        file.close();
    }
    else qDebug() << file.errorString();

    app.setApplicationName( Constant::appname );
    app.setApplicationDisplayName( Constant::appname );
    app.setApplicationVersion( Constant::appver );
    app.setOrganizationName( Constant::orgname );
    app.setOrganizationDomain( Constant::orgdomain );

    //QLocale::setDefault( QLocale( QLocale::English, QLocale::UnitedStates ) );
    QLocale::setDefault( QLocale::Spanish );

    MainWindow win;

    QStringList arguments = app.arguments();
    for( int i = 0; i < arguments.count(); ++i )
    {
        if( arguments.at(i) == "--buceador" )
        {
            if( arguments.count() > (i+1) )
                win.showBuceador( arguments.at(i+1) );
            else qWarning() << "Missing buceador usuario on command line";
        }
    }

    if( !win.isVisible() ) win.chooseBuceador();

    return app.exec();
}

/* TODO
menubar keyboard shortcut/mnemonic not working
graphs for other sample properties
edit inmersion
add inmersion
group list by viaje
avoid overlap in bookmarks in graph
marcadores personales with text
libdivecomputer
splashscreen
*/
